using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GameSite.Models.Mapping
{
    public class GameBanMap : EntityTypeConfiguration<GameBan>
    {
        public GameBanMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.AccountID)
                .IsRequired();

            this.Property(t => t.AccountName)
                .IsRequired()
                .HasMaxLength(12);

            this.Property(t => t.Status)
                .IsRequired();

            this.Property(t => t.Reason)
                .IsRequired();

            this.Property(t => t.StartTime)
                .IsRequired();

            this.Property(t => t.EndTime)
                .IsRequired();

            this.Property(t => t.CreateBy)
                .IsRequired();

            // Table & Column Mappings
            this.ToTable("GameBan");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.AccountID).HasColumnName("AccountID");
            this.Property(t => t.AccountName).HasColumnName("AccountName");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Reason).HasColumnName("Reason");
            this.Property(t => t.StartTime).HasColumnName("StartTime");
            this.Property(t => t.EndTime).HasColumnName("EndTime");
            this.Property(t => t.CreateBy).HasColumnName("CreateBy");
        }
    }
}
